<?php
namespace Admin\Controller;
use Admin\Controller\BaseController;
class MessagesController extends BaseController {
	private $tbl;
	public function _initialize(){
		$this->tbl='messages';
		$this->model=D($this->tbl);
		parent::_initialize();
	}
    public function index(){
		parent::index($this->tbl);
    }
	public function	view(){
		$id=I('get.id');//获取id
	}
	public function update(){//修改
		parent::update($this->tbl,"yjl_pic");
	}
	public function delete(){//删除
		parent::delete($this->tbl,"yjl_id","yjl_pic");
	}
	public function form(){//添加界面
		parent::form($this->tbl);
	}
	public function add(){//添加
		parent::add($this->tbl);
	}
	public function search(){
		parent::search($this->tbl,"yjl_content");
	}
	public function show(){
		parent::mod($this->tbl,"yjl_id");
	}
	public function nopass(){
		$meg=I('post.');
		//var_dump($meg);//exit;
		$data1=array(
			'yjl_id'=>$meg['id'],
			'yjl_check'=>2
		);
		//var_dump($data1);
		$mode=M($meg['tbl']);
		//var_dump($mode);
		if($res=$mode->create($data1)){//修改参数
			$mode->save();
			
			$data2=array(
				'yjl_content'=>$meg['content'],
				'yjl_stunum1'=>$meg['stunum']
			);
			if($this->model->create($data2)){
				$this->model->add();
				$this->success('更新成功！',U('index'));
			}else{
				$this->error('更新成功！',U("{$meg['tbl']}/ulist"));
			}
		}
		//$mode->_sql();
		//var_dump($res);
	}
}